package com.hb.service.approve.impl;
            
import com.hb.pojo.po.approve.Approve;
import com.hb.pojo.vo.approve.ApproveVo;
import com.hb.pojo.dto.approve.ApproveDto;
import com.hb.service.approve.ApproveService;
import com.hb.mapper.approve.ApproveMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class ApproveServiceImpl implements ApproveService {
    @Resource
    private ApproveMapper approveMapper;

    @Override
    public Approve selectByPrimaryKey(Integer id) {
        return approveMapper.selectByPrimaryKey(id);
    }

    @Override
    public Approve insertSelective(ApproveDto approveDto) {
        approveDto.setCreate_time(new Date());
        int i = approveMapper.insertSelective(approveDto);
        return i > 0 ? approveMapper.selectByPrimaryKey(approveDto.getApprove_id()) : null;
    }

    @Override
    public Approve updateByPrimaryKey(ApproveVo approveVo) {
        int i = approveMapper.updateByPrimaryKey(approveVo);
        return i > 0 ? approveMapper.selectByPrimaryKey(approveVo.getApprove_id()) : null;
    }

    @Override
    public List<ApproveDto> selectByVo(ApproveVo approveVo) {
        return approveMapper.selectByVo(approveVo);
    }
}